VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "Player"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Dim cstate As Long 'Current players state
Dim commstack As New stack  'Their command stack
Dim nextcomm As Double
Dim cstats As New stats
Dim usn As String 'Username
Dim pass As String 'Password
Dim logged As Boolean 'Are we logged in
Dim location As String 'Where are we?
Dim host As String
Dim cisloggedin As Boolean
Dim pstr As String

Property Get isloggedin() As Boolean
isloggedin = cisloggedin
End Property

Property Set isloggedin(x)
cisloggedin = x
End Property

Property Get stats()
Set stats = cstats
End Property

Property Let stats(x)
Set cstats = x
End Property

Property Let loc(x) 'Location
location = x
End Property

Property Get loc()
loc = location
End Property

Property Get state()
state = cstate
End Property

Property Get username()
username = usn
End Property

Property Get ready() 'Can this player perform an action?
ready = (Timer > nextcomm)
End Property

Property Let tme(x)  'Amount of time before the player can make his next action (in milliseconds)
nextcomm = Timer + (x / 1000)
End Property

Property Get tme()
tme = 0
End Property

Property Let state(x)
cstate = x
End Property

Property Get comstack() 'Grab the players command stack
Set comstack = commstack
End Property

Private Sub Class_Terminate()
'TODO add code to save file, if user is logged in
If Hasflag(cstate, PLAYER_LOGGEDIN) Then 'were logged in
    PlayerSave
End If
End Sub

Public Sub login(user As String, passw As String)
'Todo hash pass
pstr = "Players\" & user
cmd.say "LGN" & vbCrLf & "MSG LOGGED IN " & user
usn = user
pass = passw
PlayerLoad
cisloggedin = True
cmd.say pstr & " ATK " & cstats.atk
cmd.say pstr & " DEF " & cstats.def
cmd.say pstr & " MANA " & cstats.mana
cmd.say pstr & " LOC " & location
End Sub

Public Sub PlayerLoad()
cstats.atk = Getprop(pstr & ".atk")
cstats.def = Getprop(pstr & ".def")
cstats.mana = Getprop(pstr & ".mana")
location = Getprop(pstr & ".loc")

curloc = Findroomloc(location) 'Tell the room that we have entered the game
rooms(curloc).userenter
End Sub

Public Sub PlayerSave()
'Save the players data
End Sub
